public class Main {
    public static int solution(String[] numbers) {
        int even = 1; // 初始状态：和为偶数的组合数为1（空组合）
        int odd = 0;  // 初始状态：和为奇数的组合数为0

        for (String group : numbers) {
            int groupEven = 0;
            int groupOdd = 0;

            for (char c : group.toCharArray()) {
                int digit = c - '0';
                if (digit % 2 == 0) {
                    groupEven++;
                } else {
                    groupOdd++;
                }
            }

            // 更新状态
            int newEven = even * groupEven + odd * groupOdd;
            int newOdd = even * groupOdd + odd * groupEven;
            even = newEven;
            odd = newOdd;
        }

        return even;
    }

    public static void main(String[] args) {
        System.out.println(solution(new String[]{"123", "456", "789"}) == 14);
        System.out.println(solution(new String[]{"123456789"}) == 4);
        System.out.println(solution(new String[]{"14329", "7568"}) == 10);
    }
}